package org.example.curriculum_design_6_16.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 社会服务评分规则实体类
 * @TableName social_service_rule
 */
@TableName(value ="social_service_rule")
@Data
public class SocialServiceRule implements Serializable {
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 规则类型：position(职位类)、activity(活动类)、other(其他)
     */
    private String ruleType;

    /**
     * 规则名称
     */
    private String ruleName;

    /**
     * 规则标识key
     */
    private String ruleKey;

    /**
     * 分数值
     */
    private BigDecimal scoreValue;

    /**
     * 是否需要计算时长：0-不需要，1-需要
     */
    private Integer durationRequired;

    /**
     * 最大加分次数(NULL表示不限制)
     */
    private Integer maxTimes;

    /**
     * 学年范围：current(仅当前学年)、all(所有学年)
     */
    private String academicYearScope;

    /**
     * 规则描述
     */
    private String description;

    /**
     * 是否启用：0-禁用，1-启用
     */
    @TableField(value = "is_active")
    private Integer isActive;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 更新时间
     */
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    // 规则类型枚举
    public static final String RULE_TYPE_POSITION = "position";
    public static final String RULE_TYPE_ACTIVITY = "activity";
    public static final String RULE_TYPE_OTHER = "other";

    // 学年范围枚举
    public static final String SCOPE_CURRENT = "current";
    public static final String SCOPE_ALL = "all";

    // 职位类规则key
    public static final String RULE_KEY_GRADUATE_PRESIDENT = "graduate_president"; // 校研究生会主席团成员
    public static final String RULE_KEY_GRADUATE_LEADER = "graduate_leader"; // 校研究生会部门负责人
    public static final String RULE_KEY_GRADUATE_MEMBER = "graduate_member"; // 校研究生会部门成员
    public static final String RULE_KEY_PARTY_WORKER = "party_worker"; // 党务工作者
    public static final String RULE_KEY_EMPLOYMENT_ASSISTANT = "employment_assistant"; // 就业工作助手
    public static final String RULE_KEY_ACTING_MONITOR = "acting_monitor"; // 代理班长
    public static final String RULE_KEY_PART_TIME_COUNSELOR = "part_time_counselor"; // 兼职辅导员
    public static final String RULE_KEY_STUDENT_ASSISTANT = "student_assistant"; // 学生工作助理
    public static final String RULE_KEY_ADMIN_ASSISTANT = "admin_assistant"; // 助管
    public static final String RULE_KEY_TEACHING_ASSISTANT = "teaching_assistant"; // 助教
    public static final String RULE_KEY_RESEARCH_ASSISTANT = "research_assistant"; // 助研
    public static final String RULE_KEY_CLASS_MONITOR = "class_monitor"; // 班级班长
    public static final String RULE_KEY_CLASS_SECRETARY = "class_secretary"; // 团支书
    public static final String RULE_KEY_CLASS_COMMITTEE = "class_committee"; // 其他班委

    // 活动类规则key
    public static final String RULE_KEY_LARGE_ACTIVITY = "large_activity"; // 大型活动
    public static final String RULE_KEY_AWARD_ACTIVITY = "award_activity"; // 获奖活动
    public static final String RULE_KEY_ACADEMIC_CONFERENCE = "academic_conference"; // 学术会议工作人员
    public static final String RULE_KEY_VOLUNTEER_SERVICE = "volunteer_service"; // 志愿服务
    public static final String RULE_KEY_INSPECTION_PRACTICE = "inspection_practice"; // 考察实践活动

    // 其他规则key
    public static final String RULE_KEY_OTHER_APPROVED = "other_approved"; // 其他认定项目

    // 保留原有常量以兼容
    public static final String RULE_KEY_VOLUNTEER = "volunteer_service";
    public static final String RULE_KEY_INSPECTION = "inspection_practice";
    public static final String RULE_KEY_STUDENT_LEADER = "student_leader";
    public static final String RULE_KEY_CLASS_LEADER = "class_leader";
    public static final String RULE_KEY_ORGANIZATION_LEADER = "organization_leader";

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SocialServiceRule other = (SocialServiceRule) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRuleType() == null ? other.getRuleType() == null : this.getRuleType().equals(other.getRuleType()))
            && (this.getRuleName() == null ? other.getRuleName() == null : this.getRuleName().equals(other.getRuleName()))
            && (this.getRuleKey() == null ? other.getRuleKey() == null : this.getRuleKey().equals(other.getRuleKey()))
            && (this.getScoreValue() == null ? other.getScoreValue() == null : this.getScoreValue().equals(other.getScoreValue()))
            && (this.getDurationRequired() == null ? other.getDurationRequired() == null : this.getDurationRequired().equals(other.getDurationRequired()))
            && (this.getMaxTimes() == null ? other.getMaxTimes() == null : this.getMaxTimes().equals(other.getMaxTimes()))
            && (this.getAcademicYearScope() == null ? other.getAcademicYearScope() == null : this.getAcademicYearScope().equals(other.getAcademicYearScope()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getIsActive() == null ? other.getIsActive() == null : this.getIsActive().equals(other.getIsActive()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRuleType() == null) ? 0 : getRuleType().hashCode());
        result = prime * result + ((getRuleName() == null) ? 0 : getRuleName().hashCode());
        result = prime * result + ((getRuleKey() == null) ? 0 : getRuleKey().hashCode());
        result = prime * result + ((getScoreValue() == null) ? 0 : getScoreValue().hashCode());
        result = prime * result + ((getDurationRequired() == null) ? 0 : getDurationRequired().hashCode());
        result = prime * result + ((getMaxTimes() == null) ? 0 : getMaxTimes().hashCode());
        result = prime * result + ((getAcademicYearScope() == null) ? 0 : getAcademicYearScope().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getIsActive() == null) ? 0 : getIsActive().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ruleType=").append(ruleType);
        sb.append(", ruleName=").append(ruleName);
        sb.append(", ruleKey=").append(ruleKey);
        sb.append(", scoreValue=").append(scoreValue);
        sb.append(", durationRequired=").append(durationRequired);
        sb.append(", maxTimes=").append(maxTimes);
        sb.append(", academicYearScope=").append(academicYearScope);
        sb.append(", description=").append(description);
        sb.append(", isActive=").append(isActive);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}